/*
 * To change this license header, choose License Headers in Project Properties. To change this
 * template file, choose Tools | Templates and open the template in the editor.
 */
package chalmers.game.subterranean.ui.view;

import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.beans.property.Property;
import javafx.util.Duration;

/**
 * 
 * @author TH
 */
public abstract class Animate {

  public static void anim(Property valueToChange, Double targetValue, Double durationMillis) {

    Timeline timeline = new Timeline();
    KeyValue change = new KeyValue(valueToChange, targetValue);
    Duration time = Duration.millis(durationMillis);
    KeyFrame keyFrame = new KeyFrame(time, change);
    timeline.getKeyFrames().add(keyFrame);
    timeline.play();
  }
}
